/* 
 * File:   uentity.h
 * Author: andrey
 *
 * Unified scene, object and general
 * decorators implemented here.
 *
 * Created on 10 Январь 2011 г., 13:50
 */

#pragma once

#include "ichanges.h"
#include "isystem.h"
#include "types.h"
#include <vector>
#include <map>
#include <set>
#include <string>
#include "ieventnotifier.h"

using namespace std;

class UObject;
class UScene;

class UScene : public IChangeManager
{
public:
    UScene(IChangeManager* pUSceneCM, IChangeManager* pUObjectCM);

	~UScene(){}

	ISystemScene* extend(ISystem* pSystem, SettingsMap&);

	Error unExtend(ISystemScene* pSysScene);


private:
    
};

class UObject : public IEventNotifier
{
public:
    UObject(u32);

	virtual void subscribeForEvents( IEventSubscriber* subscriber, i32 eventType );

	virtual void unsubscribeFromEvents( IEventSubscriber* subscriber, i32 eventType );

	virtual void notifySubscribers( i32 eventType );

	PSystemObject extend(PSystemScene scene, SettingsMap& settings);

	Error extend(PSystemObject object);

	Error unExtend(PSystemObject object);

	unsigned int getID();

	void setID (u32 id);

protected:
    u32 _id;
	map<int, set<IEventSubscriber*> > _subscribers;
	map<int, set<PSystemObject> >     _extensions;

};



